package com.ww.java.generic.method.inherit;

import com.alibaba.fastjson.JSON;

/**
 * @author wanggw
 * @Date 2023年07月21 23:53
 */
public class Test01 {

    public static ResponseEntity<Person> test01() {
        Person person = new Person();
        person.setName("张三");
        person.setAge("20");

        return new ResponseEntity<>(person);
    }

    public static ResponseEntity<Person> test02() {
        Student person = new Student();
        person.setName("李四");
        person.setAge("18");
        person.setSchool("华中科技大学");

        return new ResponseEntity<>(person);
    }

    public static void main(String[] args) {
        // {"code":"1","data":{"age":"20","name":"张三"}}
        System.out.println(JSON.toJSONString(test01()));
        System.out.println("--------------------------------");
        // {"code":"1","data":{"age":"18","name":"李四","school":"华中科技大学"}}
        System.out.println(JSON.toJSONString(test02()));
    }
}
